package com.example.demo.service;

import com.example.demo.entity.User1;
import com.example.demo.mapper.User1Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class User1Service {
    @Autowired
    private User1Mapper user1Mapper;

    // 修改点：新增组合查询方法
// User1Service.java
    public List<User1> findUsers(String name, Integer minAge, Integer maxAge) {
        return user1Mapper.findByConditions(name, minAge, maxAge); // 修改方法名及参数
    }

    public List<User1> findAll() {
        return user1Mapper.findAll();
    }

    public List<User1> findByName(String name) {
        return user1Mapper.findByName(name);
    }

    public int addUser(User1 user) {
        return user1Mapper.insert(user);
    }

    public int updateUser(User1 user) {
        return user1Mapper.update(user);
    }

    public int deleteUser(String name) {
        return user1Mapper.deleteByName(name);
    }
}